.container {
  height: 100px;
  display: flex;
}

.box1 , .box2 , .box3 , .box4 {
  width: 50px;
  height: 50px;
  border-radius: 5px;
}

.box1 {
  background-color: lightcoral;
  animation: order 5s infinite linear;
}
.box2 {
  background-color: lightblue;
}
.box3 {
  background: lightpink;
}
.box4 {
  background-color: lightgreen;
}
@keyframes order {
  50%{
    order: 6;
  }
}